/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "recevoir")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Recevoir.findAll", query = "SELECT r FROM Recevoir r"),
    @NamedQuery(name = "Recevoir.findByDateDObtention", query = "SELECT r FROM Recevoir r WHERE r.dateDObtention = :dateDObtention"),
    @NamedQuery(name = "Recevoir.findByScore", query = "SELECT r FROM Recevoir r WHERE r.score = :score"),
    @NamedQuery(name = "Recevoir.findByOrganisme", query = "SELECT r FROM Recevoir r WHERE r.recevoirPK.organisme = :organisme"),
    @NamedQuery(name = "Recevoir.findByDomaineDExpertise", query = "SELECT r FROM Recevoir r WHERE r.recevoirPK.domaineDExpertise = :domaineDExpertise"),
    @NamedQuery(name = "Recevoir.findByIdentifiant", query = "SELECT r FROM Recevoir r WHERE r.recevoirPK.identifiant = :identifiant")})
public class Recevoir implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected RecevoirPK recevoirPK;
    @Basic(optional = false)
    @Column(name = "DATE_D_OBTENTION")
    @Temporal(TemporalType.DATE)
    private Date dateDObtention;
    @Basic(optional = false)
    @Column(name = "SCORE")
    private int score;
    @JoinColumns({
        @JoinColumn(name = "ORGANISME", referencedColumnName = "ORGANISME", insertable = false, updatable = false),
        @JoinColumn(name = "DOMAINE_D_EXPERTISE", referencedColumnName = "DOMAINE_D_EXPERTISE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Certification certification;
    @JoinColumn(name = "IDENTIFIANT", referencedColumnName = "IDENTIFIANT", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Candidat candidat;

    public Recevoir() {
    }

    public Recevoir(RecevoirPK recevoirPK) {
        this.recevoirPK = recevoirPK;
    }

    public Recevoir(RecevoirPK recevoirPK, Date dateDObtention, int score) {
        this.recevoirPK = recevoirPK;
        this.dateDObtention = dateDObtention;
        this.score = score;
    }

    public Recevoir(String organisme, String domaineDExpertise, int identifiant) {
        this.recevoirPK = new RecevoirPK(organisme, domaineDExpertise, identifiant);
    }

    public RecevoirPK getRecevoirPK() {
        return recevoirPK;
    }

    public void setRecevoirPK(RecevoirPK recevoirPK) {
        this.recevoirPK = recevoirPK;
    }

    public Date getDateDObtention() {
        return dateDObtention;
    }

    public void setDateDObtention(Date dateDObtention) {
        this.dateDObtention = dateDObtention;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public Certification getCertification() {
        return certification;
    }

    public void setCertification(Certification certification) {
        this.certification = certification;
    }

    public Candidat getCandidat() {
        return candidat;
    }

    public void setCandidat(Candidat candidat) {
        this.candidat = candidat;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (recevoirPK != null ? recevoirPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Recevoir)) {
            return false;
        }
        Recevoir other = (Recevoir) object;
        if ((this.recevoirPK == null && other.recevoirPK != null) || (this.recevoirPK != null && !this.recevoirPK.equals(other.recevoirPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Recevoir[ recevoirPK=" + recevoirPK + " ]";
    }
    
}
